// 定义根模块（名叫 AppModule），它告诉 Angular 如何组装应用。其初始声明中只有 AppComponent。当你往应用中添加更多组件时，它们必须声明在这里。
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';  //库中导入 Angular 模块

import { AppRoutingModule } from './app-routing.module';
import { AppComponent } from './app.component';
import {FormsModule } from '@angular/forms';

//请求模块
import {HttpClientModule} from "@angular/common/http";
//web缓存
import { HttpClientInMemoryWebApiModule } from "angular-in-memory-web-api";
import { InMemoryDataService }  from './in-memory-data.service';

import { HomeComponent } from './home/home.component'; //主页路径
import { HeroDetailComponent } from './hero-detail/hero-detail.component';
import { MessagesComponent } from './messages/messages.component';
import { DashboardComponent } from './dashboard/dashboard.component';
import { HeroSearchComponent } from './hero-search/hero-search.component'

// 每个组件都必须声明在（且只能声明在）一个 NgModule 中。
@NgModule({
  //该应用自定义组件
  declarations: [
    AppComponent,
    HomeComponent,
    HeroDetailComponent,
    MessagesComponent,
    DashboardComponent,
    HeroSearchComponent
  ],
  //该应用所需外部模块的列表
  imports: [
    BrowserModule,
    AppRoutingModule,
    FormsModule,
    HttpClientModule,//请求类
    HttpClientInMemoryWebApiModule.forRoot(
      InMemoryDataService, { dataEncapsulation: false }
    ), //请求缓存类
  ],
  providers: [],
  bootstrap: [AppComponent], //根组件
  exports :[],
})
export class AppModule { }
